package models

import (
	"time"
)

type Master struct {
	MasterId     uint      `xorm:"master_id notnull int pk autoincr"`
	Host         uint      `xorm:"host notnull int unique" valid:"required,uint32"`
	Port         uint16    `xorm:"port notnull smallint" valid:"required,port"`
	User         []byte    `xorm:"user notnull varbinary(48)" valid:"required" json:"-"`
	Password     []byte    `xorm:"password notnull varbinary(48)" valid:"required" json:"-"`
	Status       uint8     `xorm:"status notnull tinyint" valid:"required,matches(^(0|1)$)"`
	CreationDate time.Time `xorm:"creation_date notnull datetime"`
}

type Database struct {
	Name string
}

type Table struct {
	Name string
	Type string `json:"-"`
}

type Column struct {
	Field      string
	Type       string
	Collation  string
	Null       string
	Key        string
	Default    string
	Extra      string
	Privileges string `json:"-"`
	Comment    string
}

type Index struct {
	Table        string
	NonUnique    bool
	KeyName      string
	SeqInIndex   uint
	ColumnName   string
	Collation    string `json:"-"`
	Cardinality  uint   `json:"-"`
	SubPart      string `json:"-"`
	Packed       string `json:"-"`
	Null         string
	IndexType    string
	Comment      string
	IndexComment string
}

func (m *Master) TableName() string {
	return "mm_masters"
}

func (m *Master) GetDatabases() []Database {
	return nil
}
